package com.tian.auto;

import com.tian.auto.export.ExportHelper;
import com.tian.auto.parse.ParseExcelCore;
import com.tian.auto.parse.PathParseProcessor;

import org.dom4j.DocumentException;

import java.io.File;

public class AutoMain {

    public static void main(String[] args) {
//        importValuesFromExcel();

        try {
            exportValuesToExcel();
        } catch (DocumentException e) {
            e.printStackTrace();
        }

//        testDebug();
    }

    /**
     * 从excel表中导入数据到工程中
     */
    private static void importValuesFromExcel() {
//        String path = "doc" + File.separator + "sprint_2004_wait.xlsx";
        String path = "doc" + File.separator + "text.xls";
        String rootPath = "/Users/tianjinyong/Desktop/work/international";
//        String rootPath = "/Users/tianjinyong/Desktop/work/keruyun_calm3";

        PathParseProcessor.initProjectStringPathMap(rootPath);
        ParseExcelCore read = new ParseExcelCore();
        read.read(path, true);
    }

    /**
     * 将工程中的定义在xml中的string,string-array字符，导出为excel表
     */
    private static void exportValuesToExcel() throws DocumentException {

        String docFilePrefix = "calm_";
        String rootPath = "/Users/tianjinyong/Desktop/work/international";
//        String rootPath = "/Users/tianjinyong/Desktop/work/keruyun_calm3";

        ExportHelper.create(docFilePrefix, rootPath).exportValuesToExcel();
    }

    private static void testDebug() {
        int[] resource = new int[]{1, 2, 3, 5};
        for (int i : resource) {
            System.out.println("当前值：" + i);
        }
    }

}



